<link rel="stylesheet" href="${baseStaticUrl}/plugins/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="${baseStaticUrl}/plugins/ztree/js/jquery.ztree.core.js"></script>
<script type="text/javascript" src="${baseStaticUrl}/plugins/ztree/js/jquery.ztree.excheck.js"></script>
<div class="form-container">
	<div class="box">
        <form action="#" method="post" name="suvForm" id="suvForm">
        	<div class="row visa-row">
                <div id="wait-msg" class="alert alert-info"
                     style="background:url(${baseStaticUrl}/images/ajax-loader.gif) no-repeat scroll 0.5em 50%;display:none"></div>
                <div id="alert-msg" class="alert alert-success" style="display:none"></div>
                <div id="error-msg" class="alert alert-danger" style="display:none"></div>
            </div>
            <div class="row visa-row">
            	<h6 class="mg-b-20 h6-mar-sm">
                    <strong>定时任务</strong>
                </h6>
                <div class="row w-row">
                    <div class="col-md-1 col-xs-12 w-row1"><span class="span_red">*</span>任务名称</div>
                    <div class="col-md-3 col-xs-12 w-row2">                     
	                       	<input type="text" class="form-control form-control-sm" id="jobName"  maxlength="200" 
								name="scheduleJob.JOB_NAME" placeholder="" onchange="checkJobName()"
								value="${scheduleJob.JOB_NAME!}" required="required">
						   	<input type="hidden" name="scheduleJob.ID" placeholder="" id="ID"  
								value="${scheduleJob.ID!}">                        
                     </div>                                         
                     <div class="col-md-1 col-xs-12 w-row1"><span class="span_red">*</span>任务组</div>
                     <div class="col-md-3 col-xs-12 w-row2">                        
                     	<epoch:select list="${lisFun.getDictCode('PUB_SYS_MODULE')}" id="jobGroup" 
							name="scheduleJob.JOB_GROUP" value="${scheduleJob.JOB_GROUP!}" required="required"></epoch:select>                                               
                     </div>                   
                     <div class="col-md-1 col-xs-12 w-row1"><span class="span_red">*</span>状态</div>
                     <div class="col-md-3 col-xs-12 w-row2">
                            <epoch:select list="${lisFun.getDictCode('SYS_JOB_STATUS')}" id="jobStatus"
							name="scheduleJob.JOB_STATUS" value="${scheduleJob.JOB_STATUS!}" required="required"></epoch:select>
                     </div>
                 </div> 
                 <div class="row w-row">
                       <div class="col-md-1 col-xs-12 w-row1"><span class="span_red">*</span>目标类 </div>
                       <div class="col-md-11 col-xs-12 w-row2">
                            <textarea rows="4" cols="129" id="targetClass" style=" width: 100%; resize: none;word-break: break-all;" maxlength="200"
							name="scheduleJob.TARGET_CLASS" required="required">${scheduleJob.TARGET_CLASS!}</textarea>
                       </div>
                 </div>
                 <div class="row w-row">
                    <div class="col-md-1 col-xs-12 w-row1">Cron 表达式</div>
                        <div class="col-md-11 col-xs-12 w-row2"><textarea rows="4" cols="129" id="cronExpression"
                                                  style=" width: 100%; resize: none;;word-break: break-all; " maxlength="500"
                                                  name="scheduleJob.CRON_EXPRESSION">${scheduleJob.CRON_EXPRESSION!}</textarea> 
                        </div>
                 </div>
                 <div class="row w-row">
                        <div class="col-md-1 col-xs-12 w-row1">描述 </div>
                        <div class="col-md-11 col-xs-12 w-row2">
                        	<textarea rows="4" cols="129" id="jobDesc"
	                             style=" width: 100%; resize: none;word-break: break-all; " maxlength="500"
	                             name="scheduleJob.JOB_DESC">${scheduleJob.JOB_DESC!}</textarea>
	                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
	
	_headToolBar.saveBtn(null, null, suv);
	
	function suv(){
		if ($("#jobName").val() == null || $("#jobName").val() == '') {
			showErrorMessage("error-msg","任务名称不能为空！");
			$("#jobName").focus();
			return false;
		}
		if ($("#jobGroup").val() == null || $("#jobGroup").val() == '') {
			showErrorMessage("error-msg","任务组不能为空！");
			$("#jobGroup").focus();
			return false;
		}
		if ($("#jobStatus").val() == null || $("#jobStatus").val() == '') {
			showErrorMessage("error-msg","状态不能为空！");
			$("#jobStatus").focus();
			return false;
		}
		if ($("#targetClass").val() == null || $("#targetClass").val() == '') {
			showErrorMessage("error-msg","目标类不能为空！");
			$("#targetClass").focus();
			return false;
		}
		saveFun();
	}
	
	function saveFun(){
		$.ajax({
			url:"${basePath}/sys/job/save",
			data:$("form").serialize(),
			type:"post",
			success:function(data){
				if(data){
					if(data.code=="0"){
						MessageBox.success("保存成功！");
						_tabs.showPage("list");
					}else{
						MessageBox.error("保存失败！");
					}
				}else{
					MessageBox.error("保存失败！");
				}
			},
			error:function(){
				MessageBox.error("服务器错误，请稍后再试！");
			},
			async:false
		});
	}
</script>